package com.hsoft.zhxy.app.xtgl_02_01.controller;

import com.alibaba.fastjson.JSONObject;
import com.hsoft.zhxy.app.common.model.entity.JcqxYh;
import com.hsoft.zhxy.app.common.model.entity.JcqxYhbm;
import com.hsoft.zhxy.app.xtgl_02_01.model.query.YhglQuery;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import com.hsoft.zhxy.app.xtgl_02_01.service.JcqxYhService;
import com.hsoft.zhxy.app.common.model.entity.JcqxYh;

@Api(tags = "xtgl_02_01 用户")
@Log4j2
@Validated
@RestController
@RequestMapping(value = "/xtgl_02_01/jcqxYh/", produces = "application/json;charset=UTF-8")
public class JcqxYhController {

    @Autowired
    private JcqxYhService jcqxYhService;

    @ApiOperation(value = "查询单条数据", notes = "查询单条数据")
    @GetMapping("findOne")
    public JSONObject findOne(JcqxYh jcqxYh) {
        return jcqxYhService.findOne(jcqxYh);
    }


    @ApiOperation(value = "查询列表数据", notes = "查询列表数据")
    @GetMapping("findList")
    public JSONObject findList(JcqxYh jcqxYh) {
        return jcqxYhService.findList(jcqxYh);
    }


    @ApiOperation(value = "查询分页列表数据", notes = "查询分页列表数据")
    @GetMapping("findListByPage")
    public JSONObject findListByPage(YhglQuery yhglQuery) {
        return jcqxYhService.findListByPage(yhglQuery);
    }


    @ApiOperation(value = "新增", notes = "新增")
    @PostMapping("add")
    public JSONObject add(@RequestBody @Valid JcqxYh jcqxYh) {
        return jcqxYhService.add(jcqxYh);
    }


    @ApiOperation(value = "修改", notes = "修改")
    @PostMapping("update")
    public JSONObject update(@RequestBody @Valid JcqxYh jcqxYh) {
        return jcqxYhService.update(jcqxYh);
    }

    @ApiOperation(value = "删除", notes = "删除")
    @PostMapping("delete")
    public JSONObject delete(@RequestBody JcqxYh jcqxYh) {
        return jcqxYhService.delete(jcqxYh);
    }

    @ApiOperation(value = "批量删除", notes = "批量删除")
    @PostMapping("deleteBatchYh")
    public JSONObject deleteBatchYh(@RequestBody String str) {
        return jcqxYhService.deleteBatchYh(str);
    }

    @ApiOperation(value = "获取部门列表", notes = "获取部门列表")
    @GetMapping("findBmList")
    public JSONObject findBmList() {
        return jcqxYhService.findBmList();
    }

    @ApiOperation(value = "添加该用户部门", notes = "添加该用户部门")
    @PostMapping("addYhbm")
    public JSONObject addYhbm(@RequestBody JcqxYhbm yhbm) {
        return jcqxYhService.addYhbm(yhbm);
    }
    // 各方法命名需要以 find、add、update、delete开头，遵循驼峰原则


}